import datetime
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from applications.extensions import db

class AdministratorModels(db.Model):
    __tablename__ = 'administrator_user'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='管理员id')
    name = db.Column(db.String(20), comment='管理员姓名')
    avatar = db.Column(db.String(255), comment='证件照', default="/static/admin/admin/images/dpr.png")
    password_hash = db.Column(db.String(128), comment='哈希密码')
    dept_id = db.Column(db.Integer, comment='部门id')
    subject_at = db.Column(db.String(50),  comment='负责课程名称')
    create_at = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建课程时间')
    update_at = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新课程时间')


class AdministratorOPModels(db.Model):
    __tablename__ = 'administrator_op'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='操作记录id')
    operatorid= db.Column(db.Integer, comment='操作课程管理员id')
    operatorname = db.Column(db.String(20), comment='操作课程管理员姓名')
    classid = db.Column(db.Integer, comment='课程id')
    classname = db.Column(db.String(20), comment='课程名')
    create_at = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建课程时间')
    update_at = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now, comment='更新课程时间')
    success = db.Column(db.Integer)